package com.dly.blog.provider;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.dly.blog.domain.File;
import com.dly.blog.dto.email.FileDTO;
import com.dly.blog.provider.file.FileServiceProvider;
import com.dly.blog.service.FileService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@AllArgsConstructor
public class FileServiceProviderImpl implements FileServiceProvider {

    private final FileService fileService;

    @Override
    public List<FileDTO> getFile(List<String> ids) {
        return fileService.listByIds(ids)
                .stream()
                .map(file -> {
                    FileDTO fileDTO = new FileDTO();
                    fileDTO.setFileId(file.getId());
                    fileDTO.setUrl(file.getUrl());
                    return fileDTO;
                }).toList();
    }

}
